﻿using FangChanCrm.Services.Interface;
using FangChanCrmEF;
using FangChanCrmModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace FangChanCrm.Services.Realization
{
    public class t_TuanDuiRenYuanGuanLianBiaoService : It_TuanDuiRenYuanGuanLianBiaoService
    {
        public readonly MyContext _Context;

        public t_TuanDuiRenYuanGuanLianBiaoService(MyContext context)
        {
            _Context = context;
        }

        public int Add(t_TuanDuiRenYuanGuanLianBiao t_TuanDuiRenYuanGuanLianBiao)
        {
            _Context.t_TuanDuiRenYuanGuanLianBiao.Add(t_TuanDuiRenYuanGuanLianBiao);
            return _Context.SaveChanges();
        }

        public List<t_TuanDuiRenYuanGuanLianBiao> GetList(int shu)
        {
            return _Context.t_TuanDuiRenYuanGuanLianBiao.ToList();
        }

        public t_TuanDuiRenYuanGuanLianBiao GetRenYuan(int renyid)
        {
            return _Context.t_TuanDuiRenYuanGuanLianBiao.FirstOrDefault(x => x.ZhiYeGuWenId == renyid);
        }
    }
}
